package com.javachmapi.springbootjsoup.demo;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;

import java.io.IOException;

/**
 * create by 宋利军
 */
public class Test {

    public static void main(String[] args) {

        try {
            Document doc = Jsoup.connect("https://api.healthjd.com/client") //url
                    .data("t", "8803") //请求参数
                    .data("body", "{\"pageIndex\":1,\"pageSize\":20,\"keyWords\":{\"departmentId\":69,\"searchEntryId\":4},\"fromDetail\":true}") //请求参数
                    .ignoreContentType(true) //忽略
                    .userAgent("Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36") //用户代理标题
                    .cookie("cookie", "__jdc=98075014; mba_muid=1596167096735958833328; loginWQBiz=nethp-diag; mb2c_deviceid=H5_DEV_ABEB3E02-3519-434B-8283-744D8707EF6F; __jda=98075014.1596167096735958833328.1596167096.1596171994.1596174854.3; RT=\"z=1&dm=healthjd.com&si=8nxjq8m401p&ss=kd9tkwvd&sl=9&tt=3ma\"; __jdb=98075014.10.1596167096735958833328|3.1596174854; __jdv=98075014%7Ccategory%7Ct_335139774%7Cappshare%7CWxfriends%7C1596175782268; mba_sid=15961748546147475419345861569.10")   //cookie
                    .timeout(3000)  //超时时间
                    .post();

            System.out.println(doc.body());
            System.out.println(doc.html());

        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
